// ignore_for_file: constant_identifier_names

import 'package:flutter/material.dart';

class Colours {
  static const Color app_main_color = Color(0xFFFFFFFF);
  static const Color text_disabled = Color(0xFFD4E2FA);
  static const Color dark_text_disabled = Color(0xFFCEDBF2);
  static const Color dark_button_text = Color(0xFFF2F2F2);
  static const Color dark_app_main = Color(0xFF3F7AE0);
  static const Color dark_button_disabled = Color(0xFF83A5E0);
  static const Color button_disabled = Color(0xFF96BBFA);
  static const Color dark_text = Color(0xFFB8B8B8);
  static const Color title_text_color = Color(0xFF5793FA);
  static const Color app_chat_text_background_color = Color(0xFF3FC5B2);


  static const Color app_main_background_color = Color(0xFFF2392E);
  static const Color app_main_text_color = Color(0xFFFC5129 );
  static const Color app_textField_background_color = Color(0xFFF7F7F7);
  static const Color app_black_text_color = Color(0xFF000000);
  static const Color app_line_color = Color(0xFFA6A6A6 );
  static const Color app_sendcode_color = Color(0xFF8F8F8F );
  static const Color app_msg_color = Color(0xFFFFFAD8);
  static const Color app_msg_text_color = Color(0xFFA77F34);
  static const Color app_home_tag_color = Color(0xFFFD562B);
  static const Color app_icon_bg_color = Color(0xFFE9E9E9);
  static const Color app_text_color = Color(0xFF696969);
  static const Color app_text_bluer_color = Color(0xFF3371FE);
  static const Color app_text_red_color = Color(0xFFFC5129);
  static const Color app_text_line_color = Color(0xFFF4F4F4);
  static const Color app_forward_color = Color(0xFF696969);
  static const Color app_bank_text_color = Color(0xFF2C2C2C);
  static const Color app_orange_text_color = Color(0xFFFFD078);
  static const Color app_logoff_text_color = Color(0xFFE5E5E5);
  static const Color app_logoff_serve_text_color = Color(0xFF3F3F3F);
  static const Color app_repayment_text_color = Color(0xFF0091FF);
  static const Color app_order_state_text_color = Color(0xFF3371FE);
  static const Color app_copy_background_color = Color(0xFFD6B875);
  static const Color app_copy_text_color = Color(0xFFA77F34);
  static const Color app_unclickable_color = Color(0xFFCBCBCB);
  static const Color app_dashedline_color = Color(0xFFEAEAEA);
  static const Color app_image_background_color = Color(0xFFF7F8FC);



  static const Color mine_tag_text_color = Color(0xFF303133);
  static const Color arrow_tag_color = Color(0xFF91919F);
  static const Color indicator_active_color = Color(0xFF4C846C);
  static const Color indicator_color = Color(0xFFC5CAD2);
  static const Color line = Color(0xFF4C846C);
  static const Color color_33 = Color(0xFF303133);
  static const Color blue_text_color = Color(0xFF3a97fe);
  static const Color color_99 = Color(0xFF999999);
  static const Color arrow_forward_color = Color(0xFFA1A1A1);
  static const Color highlight_text_color = Color(0xFFB53500);
  static const Color edit_icon_color = Color(0xFF230D0C);
  static const Color sub_title_color = Color(0xFF666666);
  static const Color task_tag_text_color = Color(0xFF525559);
  static const Color grey_text_color = Color(0xFF7D7D7D);
  static const Color green_text_color = Color(0xFF7AD360);
  static const Color bg_color = Color(0xfff1f1f1);
  static const Color empty_background_color = Color(0xFFF5F5F5);
  static const Color system_off_color = Color(0xFFD7D7D7);
  static const Color system_background_color = Color(0xFFF6F7F7);
  static const Color calendar_text_color = Color(0xFF222124);
  static const Color calendar_active_text_color = Color(0xFF00AA90);
  static const Color calendar_open_text_color = Color(0xFF888888);
  static const Color drawer_text_color = Color(0xFF333333);
  static const Color course_file_line_color = Color(0xFFE2E2E2);
  static const Color course_file_text_color = Color(0xFF111111);
  static const Color task_line_color = Color(0xFFEEEEEE);
  static const Color work_sort_color = Color(0xFFF6F6F6);
  static const Color work_sort_icon_color = Color(0xFFBBBBBB);
  static const Color score_details_background_color = Color(0xFFF5F5F5);
  static const Color score_text_color = Color(0xFF999999);
  static const Color BarChart_color = Color(0xFF4359BA);
  static const Color PieChart_color = Color(0xFF82C564);
  static const Color notice_color = Color(0xFF6C6C6C);
  static const Color notice_background_color = Color(0xFFF59E2D);
  static const List colors = [
    "#1567A4",
    "#3E6E63",
    "#B62E2F",
    "#C3367B",
    "#5828B5",
    "#2F36A6",
    "#545C5F",
    "#8AB966",
    "#AB7C7D",
    "#E0E570",
    "#D1B68C",
    "#4E831D",
    "#5C2B8E",
    "#4CBE4A",
    "#A58968",
  ];

  static Color stringColor(String colorString) {
    int value = 0x00000000;
    if (colorString.isNotEmpty) {
      if (colorString[0] == '#') {
        colorString = colorString.substring(1);
      }
      value = int.tryParse(colorString, radix: 16)!;
      if (value < 0xFF000000) {
        value += 0xFF000000;
      }
    }
    return Color(value);
  }

  // static Color stringAnAlphaColor(String colorString,{double alpha = 1.0}){

  // }

    static Color stringAnAlphaColor(String colorString, {double alpha = 1.0}) {
    String colorStr = colorString;
    // colorString未带0xff前缀并且长度为6
    if (!colorStr.startsWith('0xff') && colorStr.length == 6) {
      colorStr = '0xff$colorStr';
    }
    // colorString为8位，如0x000000
    if(colorStr.startsWith('0x') && colorStr.length == 8) {
      colorStr = colorStr.replaceRange(0, 2, '0xff');
    }
    // colorString为7位，如#000000
    if(colorStr.startsWith('#') && colorStr.length == 7) {
      colorStr = colorStr.replaceRange(0, 1, '0xff');
    }
    // 先分别获取色值的RGB通道
    Color color = Color(int.parse(colorStr));
    int red = color.red;
    int green = color.green;
    int blue = color.blue;
    // 通过fromRGBO返回带透明度和RGB值的颜色
    return Color.fromRGBO(red, green, blue, alpha);
  }
}
